package com.example.studyapp

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast

class change_uername_1 : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_change_uername_1)
        //监听用户名编辑界面
        val change_username_save: Button =this.findViewById(R.id.change_username_save)      //保存按钮
        val change_username_edit: EditText =this.findViewById(R.id.change_username_edit)    //用户名编辑框
        change_username_save.setOnClickListener { v->
            if(change_username_edit.text.length>=4){
                //发送昵称到服务器
                //然后退出当前界面
                Toast.makeText(this, "昵称设置成功", Toast.LENGTH_SHORT)
                    .show()
                this.finish()
            }else{
                //昵称太短
                Toast.makeText(this, "昵称长度要多于4个字符", Toast.LENGTH_SHORT)
                    .show()
            }
        }
    }
}